package subject_set.offer100;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/**
 * @author haomin
 * @date 2022/10/20 22:30
 **/
public class Offer45 {
    class Solution {
        public String minNumber(int[] nums) {
            List<String> list = new LinkedList<>();
            for(int i : nums) list.add(Integer.toString(i));
            Collections.sort(list, (x, y) -> (x+y).compareTo(y+x));
            StringBuffer sb = new StringBuffer();
            for(int i = 0; i < list.size(); ++i){
                sb.append(list.get(i));
            }
            return sb.toString();
        }
    }
}